package com.danger.dy.common.models.request;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 分页请求
 */
public class PageRequest {

    private Integer page = 1;

    private Integer size = 20;

    public PageRequest() {
    }

    public PageRequest(Integer page, Integer size) {
        this.page = page;
        this.size = size;
    }

    public Integer getSize() {
        return size;
    }

    public void setSize(Integer size) {
        this.size = size;
    }

    public Integer getPage() {
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    @JsonIgnore
    public Integer getOffset() {
        return (page - 1) * size;
    }

    @JsonIgnore
    public Integer getLimit() {
        return this.size;
    }
}
